#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main(int argc,char **argv)
{

  vector<int> height;
  height.push_back(2);// 2,1,5,6,2,3
  height.push_back(1);// 2,1,5,6,2,3
  height.push_back(5);// 2,1,5,6,2,3
  height.push_back(6);// 2,1,5,6,2,3
  height.push_back(2);// 2,1,5,6,2,3
  height.push_back(3);// 2,1,5,6,2,3

  vector<int>   area;
  int n=height.size();
  for(int len=1;len<=n;++len)
  {
    for(int j=0;j<n-len+1;++j)
    {
      int larea=0;
      int minh=height.at(j);
      for(int i=0;i<len;++i)
      {
        if(height.at(j+i)<minh)
          minh=height.at(j+i);
      }
      area.push_back(minh*len);
      cout<<minh*len<<endl;

    }
  }
/*  std::vector<int>::iterator max= std::max_element(area.begin(), area.end());*/
  //cout<< *max<<endl;
  /*return *max;*/

  int max=area.at(0);
 for(int i=0;i<area.size();++i)
 {
     if(area.at(i)>max)
     max=area.at(i);
 }
 cout<<max<<endl;
  return max;


}

